<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateFeeAnnualOrderTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('fee_annual_order', function (Blueprint $table) {
            $table->id();
            $table->string('feeOrderNo', 60)->default('')->comment('年费订单号');
            $table->unsignedInteger('shopId')->default(0)->comment('门店id');
            $table->unsignedInteger('shouldPayPrice')->default(0)->comment('订单金额');
            $table->unsignedInteger('payPrice')->default(0)->comment('支付金额');
            $table->unsignedTinyInteger('payStatus')->default(0)->comment('支付状态 0-待支付 1 - 部分支付 2-支付完成');
            $table->unsignedInteger('manageFee')->default(0)->comment('管理年费');
            $table->unsignedInteger('systemFee')->default(0)->comment('数字系统服务费');
            $table->unsignedInteger('endTime')->default(0)->comment('到期时间');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->unsignedTinyInteger('isDeleted')->default(0)->comment('是否删除');
            $table->collation = 'utf8mb4_general_ci';
            $table->index('shopId', 'idxShopId');
            $table->index('feeOrderNo', 'idxFeeOrderNo');
            $table->index('payStatus', 'idxPayStatus');
            $table->index('endTime', 'idxEndTime');
            $table->comment = '年费订单 - 订单列表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('fee_annual_order');
    }
}
